<template>
<el-dialog class="el-dialog" title="修改部门信息" v-model="dialogFormVisible" :append-to-body="append">
    <el-form :model="department">
        <el-form-item label="名称" :label-width="formLabelWidth">
            <el-input v-model="department.name" placeholder="请输入名称" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="排序" :label-width="formLabelWidth">
            <el-input placeholder="请输入排序" v-model="department.sort"></el-input>
        </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="submitForm">确 定</el-button>
    </div>
</el-dialog>
</template>

<script>
import instance from '@/utlis/request.js'
import instanceToken from "@/utlis/tokenIdentify.js";
export default {
    name: 'EditDialog',
    components: {},
    data() {
        return {
            dialogFormVisible: false,
            append: true,
            id: '',
            department: {
                name: '',
                sort: ''
            },
            formLabelWidth: '120px'
        };
    },
    created() {},
    methods: {
        initdata(id) {
            this.id = id
          instanceToken.get("/department/leader/initdata/" + id).then(res => {
                this.department = res.data.data
            })
        },
        submitForm() {
            this.dialogFormVisible = false;
            var id = this.id;
          instanceToken.post("/department/leader/edit",this.department,{
                params:{
                    id:id
                }
            }).then(res =>{
                this.$parent.$parent.findAll();
            });
            
        },
        show() {
            this.dialogFormVisible = true;
        },
        close() {
            this.dialogFormVisible = false;
        }
    },

}
</script>

<style>
.el-dialog {
    width: 500px;
}
</style>
